package demo;

public class Test {

    public static void main(String[] args) {
        //加法
        Operation add = OperationFactory.getOperation("+");
        add.setValue1(1);
        add.setValue2(1);
        System.out.println(add.getResult());

        //减法
        Operation sub = OperationFactory.getOperation("-");
        sub.setValue1(3);
        sub.setValue2(2);
        System.out.println(sub.getResult());

        //乘法
        Operation mul = OperationFactory.getOperation("*");
        mul.setValue1(3);
        mul.setValue2(4);
        System.out.println(mul.getResult());

        //除法
        Operation div = OperationFactory.getOperation("/");
        div.setValue1(3);
        div.setValue2(1);
        System.out.println(div.getResult());
    }
}
